#include <cstdio>
#include <iostream>
#include <clocale>
#include <cstdlib>

#include "tftpclient.h"
#include "parser.h"


int main(int argc, char** argv)
{
    
    // Load the host.
    if(argc != 2)
    {
        cout << "TFTP Client Error: No host has been provided." << endl << "Usage: " << argv[0] << " [www.example.com]" << endl << endl;
        string parameter;
        cout << "Please indicate the new host you wish to connect to: ";
        getline(cin,parameter);
        loadHostAddress(parameter.c_str());
        cout << "New host successfully loaded, continuing execution..." << endl << endl;
    }
    else
        loadHostAddress(argv[1]);

    cout << "Welcome to the TFTP Client, you can now start typing your instructions..." << endl;
    readCommands();
    
    clearHostAddress();

    return 0;
}
